home *** CD-ROM | disk | FTP | other *** search
- Path: news.dpi.udec.cl!tarmstro
- From: tarmstro@caleuche.inf.UDEC.CL (Thomas Armstrong Kobrich)
- Newsgroups: comp.lang.c++
- Subject: Array of Funcions ??
- Date: 10 Apr 1996 17:27:40 GMT
- Organization: Universidad de Concepcion, Concepcion - Chile
- Message-ID: <4kgr2c$b99@news.dpi.udec.cl>
- NNTP-Posting-Host: caleuche.inf.udec.cl
- X-Newsreader: TIN [version 1.2 PL2]
-
- Hi there:
-
- I've the following problem. I Want to define an array
- of functions (all with the same return value an the same parameters,
- of course), named FuncArray, but I'dont know how to do it.
- The sentence:
-
- static void (Func)(void);
-
- declares a variable named Func, that is a pointer to a
- function with prorotype of the form
-
- void foo(void);
-
- This way, it is legal to write the following:
-
- void foo2(void)
- { .... }
-
- static void (Func)(void);
-
- int main(void)
- {
- Func=foo2;
- ...
- Func(); /* calls foo2() in fact */
- ...
- }
-
- I want to declare an array of funcions so I can write
-
- for(i=0; i<MAX; i++)
- (Func[i])();
-
- or somthing like that.
-
- Help would be wery appreciated. Thanx.
-
- --
- ------------------------------------------------------------------
- | Thomas Armstrong Kobrich | tarmstro@caleuche.inf.udec.cl |
- | Concepcion - Chile | Universidad de Concepcion |
- ------------------------------------------------------------------
-